﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title></title>
    
    <link href="CSS/left.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            //菜单折叠代码
            $(".menuDiv").live("click", function () {
                $(this).next("div").slideToggle(300);
            });

            //得到当前登陆用户拥有权限的菜单
            $.ajax({
                url: "left.asmx/SelectMenus",
                type: "post",
                data: JSON.stringify({}),
                dataType: "json",
                contentType: "application/json",
                success: function (obj) {
                    var roots = obj.d;
                    //显示一级菜单
                    var mp = $("#menuPanel");
                    for (var i = 0; i < roots.length; i++) {
                        mp.append("<div class='menuDiv'>" + roots[i].MenuName + "</div>");
                        var contentDiv = $("<div class='contentDiv' style='display:none;'></div>").appendTo(mp);
                        //显示二级菜单
                        for (var j = 0; j < roots[i].SubMenus.length; j++) {
                            contentDiv.append('<div><img src="images/left.gif" /><a href="' + roots[i].SubMenus[j].URL + '" target="main">' + roots[i].SubMenus[j].MenuName + '</a></div>');
                        }
                    }
                }, error: function (xmlhttp) {
                    alert("错误：" + xmlhttp.responseText);
                }
            });
        });
    </script>
</head>
<body>
<table cellpadding="0" cellspacing="0">
    <tr>
        <td id="td1"></td>
        <td id="td2">
            <div id="div1">管理菜单
            </div>
            <div id="menuPanel">
                
            </div>
        </td>
    </tr>
</table>
</body>
</html>